<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="lg" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="lg2"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cookie.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
  
    <div class="x-nav">
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        刷新</a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="${pageContext.request.contextPath}/staff/staffList" method="post">
        
          <input type="text" name="staff_name" value="${s.staff_name}" placeholder="请输入用户名" autocomplete="off" class="layui-input">
		<div class="layui-inline">
      		<div class="layui-input-inline">
				<select name="sex" lay-verify="required" lay-search="">
					<lg:if test="${s.sex=='女'}">
		          		<option value ="${s.sex}">${s.sex}</option>
		          	</lg:if>
		          	<lg:if test="${s.sex=='男'}">
		          		<option value ="${s.sex}">${s.sex}</option>
		          	</lg:if>
		          	<option value ="">请选择性别</option>
		          <option value ="男">男</option>
				  <option value ="女">女</option>
				  
		        </select>
	        </div>
        </div>
          <input type="text" value="${s.card}" name="card"  placeholder="请输入身份证号" autocomplete="off" class="layui-input">
          <input type="text" value="${s.staff_code}" name=staff_code  placeholder="请输入员工编号" autocomplete="off" class="layui-input">
          <input type="text" value="${s.age}" name="age"  placeholder="请输入年龄" autocomplete="off" class="layui-input">
          <input type="text" value="${s.nation}" name="nation"  placeholder="请输入民族" autocomplete="off" class="layui-input">
          <input type="text"  value="${s.degree}" name="degree"  placeholder="请输入学历" autocomplete="off" class="layui-input">
          <input type="text" value="${s.address}" name="address"  placeholder="请输入住址" autocomplete="off" class="layui-input">
	      <div class="layui-inline">
		      <div class="layui-input-inline">
		        <select name="state" lay-verify="required" lay-search="">
		          <option value="">选择就职状态</option>
			          	<option value="在职">在职</option>
			          	<option value="离职">离职</option>
		        </select>
		      </div>
	      </div>
	      
	      
	      <div class="layui-inline">
		      <div class="layui-input-inline">
		        <select name="dept_id" lay-verify="required" lay-search="">
		          <option value="">选择部门</option>
			          <lg:forEach items="${dept}" var="de">
			          	<option value="${de.dept_id}">${de.dept_name}</option>
			          </lg:forEach>
		        </select>
		      </div>
	      </div>
           <%-- <input type="text" value="${s.state}" name="title_name"  placeholder="职位" autocomplete="off" class="layui-input"> --%>
          <button class="layui-btn"  type="submit" ><i class="layui-icon">&#xe615;</i></button>
        
      </div>
      <xblock> 
        <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
        <a href="${pageContext.request.contextPath}/staff/staffAdd">添加</a>
        <span class="x-right" style="line-height:40px">-------当前页有${staff.endRow}条数据  </span>  
        <span class="x-right" style="line-height:40px">总共有${staff.total}条数据 </span>  
      </xblock> 
      <table class="layui-table x-admin">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>id</th>
            <th>员工编号</th>
            <th>员工姓名</th>
            <th>员工性别</th>
            <th>员工身份证号</th>
            <th>员工籍贯</th>
            <th>员工生日</th>
            <th>员工年龄</th>
            <th>员工民族</th>
            <th>政治面貌</th>
            <th>婚否</th>
            <th>计算机等级</th>
            <th>英语等级</th>
            <th>员工学历</th>
            <th>员工邮箱</th>
            <th>员工家庭住址</th>
            <th>员工爱好</th>
            <th>员工证件照</th>
            <th>员工状态</th>
            <th>操作</th> 
            </tr>
        </thead>
        <tbody>
        <lg:forEach items="${staff.list}" var="s">
			<tr>
			
			<td><div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='${s.id}'><i class="layui-icon">&#xe605;</i></div></td>
				<td>${s.id}</td>
				<td>${s.staff_code}</td>
				<td>${s.staff_name}</td>
				<td>${s.sex}</td>
				<td>${s.card}</td>
				<td>${s.natives}</td>
				<td><fmt:formatDate value="${s.date}" pattern="yyyy-MM-dd" /></td>
				<td>${s.age}</td>
				<td>${s.nation}</td>
				<td>${s.political}</td>
				<td>${s.marry}</td>
				<td>${s.computer}</td>
				<td>${s.language}</td>
				<td>${s.degree}</td>
				<td>${s.email}</td>
				<td>${s.address}</td>
				<td>${s.specialty}</td>
				<td><img alt="" src="${pageContext.request.contextPath}/${s.photo}" style="width: 50px;height:50px;border-radius:20px"></td>
				<td>${s.state}</td>
				<td>
	              <a title="修改"  href="${pageContext.request.contextPath}/staff/getUpdateMess?id=${s.id}">
	                <i class="layui-icon">&#xe642;</i>
	              </a>
	              <a  href="${pageContext.request.contextPath}/staff/getOneStaff?id=${s.id}"  title="详细信息">
	                <i class="layui-icon">&#xe601;</i>
	              </a>
	            </td>
	            
			</tr> 
		</lg:forEach>
        </tbody>
      </table>
      <div class="page">
        <div>
          <a class="prev"  href="${pageContext.request.contextPath}/staff/staffList?startPage=${staff.prePage}&PageSize=${staff.pageSize}">&lt;&lt;</a> 
          <a class="num" href="${pageContext.request.contextPath}/staff/staffList?startPage=1&PageSize=${staff.pageSize}">首页</a>
          <lg:forEach items="${staff.navigatepageNums}" var="na">
          	<lg:if test="${na==staff.pageNum}">
         		<a class="num" href="${pageContext.request.contextPath}/staff/staffList?startPage=${na}&PageSize=${staff.pageSize}"  style="color:red;font-size=16px">${na}</a>
        	</lg:if>
        	<lg:if test="${na!=staff.pageNum}">
        		<a class="num" href="${pageContext.request.contextPath}/staff/staffList?startPage=${na}&PageSize=${staff.pageSize}"  >${na}</a>
        	</lg:if>
          </lg:forEach>
          <a class="num" href="${pageContext.request.contextPath}/staff/staffList?startPage=${staff.pages}&PageSize=${staff.pageSize}">尾页</a>
          <a class="prev" href="${pageContext.request.contextPath}/staff/staffList?startPage=${staff.nextPage}&PageSize=${staff.pageSize}">&gt;&gt;</a> 
          <span>
	          <form action="${pageContext.request.contextPath}/staff/staffList" method="post" >
		         <input type="text" placeholder="输入展示数量" name="PageSize" value="${staff.pageSize}"/>
		         <input value="刷新" class="glyphicon glyphicon-refresh" type="submit">
	          </form>
          </span>
          
        </div>
      </div>
</form>
    </div>
    <script type="text/javascript">
    function delAll (argument) {

        var id = tableCheck.getData();
  
        layer.confirm('确认要删除吗？'+id,function(index){
         
         $.ajax({
		    url:"${pageContext.request.contextPath}/staff/delStaffs",   
		    data:{"id":id.join(",")},
		    dataType:"json",
		    success:function(data){
              
             }
         });
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }
    </script>
  </body>
</html>